<template>
  <view class="main">
    <quick-button></quick-button>
    <!-- 用户信息 -->
    <view class="top">
      <!-- 姓名等信息 -->
      <view class="top-title">
        <text class="top-title-name">{{ infoDetails.patientName }}</text>
        <u-line
          direction="col"
          margin=" 0rpx 20rpx 0 20rpx"
          length="32rpx"
          color="#999999"
        ></u-line>
        <text class="top-title-age">{{ infoDetails.patientGender }}</text>
        <u-line
          direction="col"
          margin=" 0rpx 20rpx 0 20rpx"
          length="32rpx"
          color="#999999"
        ></u-line>
        <text class="top-title-sex">{{ infoDetails.patientAge }}岁</text>
        <text class="top-title-more" @click="informationfn">查看更多信息</text>
        <u-icon name="arrow-right" color="#00bcb2"></u-icon>
      </view>
      <!-- 编号等信息 -->
      <view class="top-content">
        <view class="numbering">
          <view class="numbering-title">医保类型</view>
          <view class="numbering-number">
            {{ infoDetails.medicalNumber ? infoDetails.medicalNumber : "无" }}
          </view>
        </view>
        <view class="contact">
          <view class="contact-title">联系人</view>
          <view class="contact-number">
            <text style="font-weight: 600">{{ infoDetails.personName }}</text>
            {{ infoDetails.personPhone }}
          </view>
        </view>
        <view class="dateapplication">
          <view class="dateapplication-title">申请日期</view>
          <view class="dateapplication-number">
            {{ infoDetails.createDate }}
          </view>
        </view>
      </view>
      <!-- 步骤条 -->
      <u-steps :current="steps">
        <u-steps-item title="上门评估"></u-steps-item>
        <u-steps-item title="部门审核"></u-steps-item>
        <u-steps-item title="建床成功"></u-steps-item>
        <u-steps-item title="服务中"></u-steps-item>
        <u-steps-item title="撤床"></u-steps-item>
      </u-steps>
    </view>
    <!-- 机构信息 -->
    <view class="content">
      <view class="content-title">机构信息</view>
      <view class="content-body" @click="goJigou">
        <!-- 机构图片 -->
        <view class="content-body-left">
          <image
            class="content-body-left-image"
            :src="agencyInfo.thumbnail | filterUrl"
          ></image>
        </view>
        <!-- 机构信息内容 -->
        <view class="content-body-right">
          <view>{{ agencyInfo.title || "机构标题" }}</view>
          <view style="display: flex; align-items: center">
            <image
              class="content-body-right-image"
              src="../../../static/feixiang/evaluate/postion@2x.png"
            ></image>
            <view class="content-body-right-address1">
              {{ agencyInfo.address }}
            </view>
          </view>
          <view class="content-body-right-address">{{
            agencyInfo.content
          }}</view>
        </view>
      </view>
      <!-- 负责的团队 -->
      <view class="team" v-show="steps > 0">
        <view style="font-size: 32rpx" class="team-title">负责的团队</view>
        <view class="team-items">
          <view style="font-size: 32rpx" class="team-items-name">
            {{ infoDetails.teamName || "无数据" }}
          </view>
          <view class="team-items-icon">
            <!-- 	<image
							class="items-icon-arrow"
							src="../../../static/feixiang/evaluate/arrow@2x.png"
						></image> -->
          </view>
        </view>
      </view>
    </view>

    <!-- 分割线 -->
    <view v-if="emptyState" class="dividingLine"></view>

    <!-- 审核流程tabs -->
    <u-tabs v-if="emptyState" :list="list" @click="click"></u-tabs>
    <!-- tabs---治疗记录 -->
    <view v-if="sure" v-show="tabsindex === 0" class="reatmentRecords">
      <u-steps :current="treatmentrecords" direction="column" dot>
        <!-- 撤床成功展示 -->
        <u-steps-item v-if="stateFlag >= '5.0'">
          <view class="revokebed-slot" slot="desc">
            <view class="revokebed-slot-head">
              <text class="revokebed-slot-head-left">撤床</text>
              <text class="revokebed-slot-head-right">{{
                infoDetails.startBedTime | timeFilter
              }}</text>
            </view>
            <view class="revokebed-slot-body">
              <view class="revokebed-slot-body-title">
                <text>撤床原因：{{ infoDetails.removeReason }}</text>
              </view>
              <view v-if="stateFlag == '6.0'" class="revokebed-slot-body-box">
                <text class="revokebed-slot-body-box-left">已同意</text>
                <text class="revokebed-slot-body-box-right">{{
                  infoDetails.endBedTime
                }}</text>
              </view>
              <view v-if="managerconfirms" class="revokebed-slot-manager">
                <view class="revokebed-slot-body-box-head">
                  <text class="revokebed-slot-body-box-left">总管理确定</text>
                  <text class="revokebed-slot-body-box-right">{{
                    infoDetails.endBedTime
                  }}</text>
                </view>
                <view class="revokebed-slot-body-box-body">
                  <text class="revokebed-slot-body-box-body-text"
                    >缘由：患者死亡无法确认</text
                  >
                </view>
              </view>
              <view v-if="stateFlag == '5.0'" class="revokebed-slot-body-box">
                <text class="revokebed-slot-body-box-left">待确认</text>
              </view>
            </view>
          </view>
        </u-steps-item>
        <!-- 每一条治疗记录--循环 -->
        <u-steps-item
          v-if="teartRecord"
          v-for="item in teartRecord"
          :key="item.id"
        >
          <view class="reatmentRecords-steps" slot="desc">
            <!-- 标题 -->
            <view class="steps-title">
              <!-- 左 -->
              <text class="steps-title-left">治疗记录</text>
              <!-- 右 -->
              <text class="steps-title-right">{{ item.updateDate }}</text>
            </view>
            <!-- 内容 -->
            <view class="steps-content">
              <!-- 头部 -->
              <view class="steps-content-head">
                <text>
                  {{ item.updatePerson }}
                  <text class="steps-content-head-text">医生上门治疗</text>
                </text>
              </view>
              <!-- 主体 -->
              <view class="steps-content-body">
                <!-- 病情情况 -->
                <view class="condition">
                  <text>病情情况：</text>
                  <text>{{ item.illness }}</text>
                </view>
                <!-- 治疗医嘱 -->
                <view class="treatmentOrder">
                  <text>治疗医嘱：</text>
                  <text>{{ item.doctorMessage }}</text>
                </view>
                <view class="remark">
                  <text>服务项目：</text>
                  <text>{{
                    item.serverProject ? item.serverProject : "无"
                  }}</text>
                </view>
                <view class="remark">
                  <text>储备医生：</text>
                  <text>{{ item.togetherDoctor || "无" }}</text>
                </view>
                <!-- 备注 -->
                <view class="remark">
                  <text>备注：</text>
                  <text>{{ item.remark || "无" }}</text>
                </view>
                <!-- 治疗图片 -->
                <view class="treatmentPictures">
                  <view
                    class="image-box"
                    v-for="(item2, index) in item.fileUrl"
                    :key="index"
                  >
                    <image
                      class="treatmentPictures-image"
                      :src="item2 | imgfilter"
                      @click="viewIMG(item2)"
                    ></image>
                  </view>
                </view>
              </view>
            </view>
          </view>
        </u-steps-item>
      </u-steps>
      <view v-if="teartRecord.length == 0" class="">
        <u-empty text="暂无治疗记录"></u-empty>
      </view>
      <!-- 撤床按钮 -->
      <view class="btn-footer">
        <button
          v-if="stateFlag == '5.0' && stateFlag != '6.0'"
          class="revokebedbtn"
          @click="revokebedfn"
        >
          确认撤床
        </button>
      </view>
    </view>

    <!-- tabs---部门审核 -->
    <view v-if="depsure" v-show="tabsindex === 0" class="eepartmentAudit">
      <u-steps :current="eepartmentaudit" direction="column" dot>
        <!-- 大医院科室审核 -->
        <u-steps-item
          class="steps-item"
          title="大医院科室审核"
          :error="doctorteamaudit"
        >
          <view class="slot-desc" slot="desc">
            <!-- 头部 -->
            <view class="slot-desc-head">
              <view v-show="stateFlag > 0.1" class="slot-desc-left"
                >审核通过</view
              >
              <view
                v-show="stateFlag == 0.1"
                class="slot-desc-left slot-desc-error"
                >审核未通过</view
              >
              <view v-show="stateFlag < 0.1" class="slot-desc-left"
                >待审核</view
              >
              <view v-show="stateFlag >= 0.1" class="slot-desc-right"
                >审核时间： {{ oneTime }}</view
              >
            </view>
            <!-- 内容 -->
            <view v-show="stateFlag == 0.1" class="slot-desc-body">
              {{ oneRes }}
            </view>
          </view>
        </u-steps-item>

        <!-- 机构审核 -->
        <u-steps-item
          class="steps-item"
          title="机构审核"
          :error="mechanismaudit"
        >
          <view class="slot-desc" slot="desc">
            <!-- 头部 -->
            <view class="slot-desc-head">
              <view v-show="stateFlag > 1.4" class="slot-desc-left"
                >审核通过</view
              >
              <view
                v-show="stateFlag == 1.4"
                class="slot-desc-left slot-desc-error"
                >审核未通过</view
              >
              <view v-show="stateFlag < 1.4" class="slot-desc-left"
                >待审核</view
              >
              <view v-show="stateFlag >= 1.4" class="slot-desc-right"
                >审核时间： {{ oneTime }}</view
              >
            </view>
            <!-- 内容 -->
            <view v-show="stateFlag == 1.4" class="slot-desc-body">
              {{ oneRes }}
            </view>
          </view>
        </u-steps-item>
        <!-- 卫键局科室审核 -->
        <u-steps-item
          class="steps-item"
          title="卫键局科室审核"
          :error="departmentaudit"
        >
          <view class="slot-desc" slot="desc">
            <!-- 头部 -->
            <view class="slot-desc-head">
              <view v-show="stateFlag > 2.1" class="slot-desc-left"
                >审核通过</view
              >
              <view
                v-show="stateFlag == 2.1"
                class="slot-desc-left slot-desc-error"
                >审核未通过</view
              >
              <view v-show="stateFlag < 2.1" class="slot-desc-left"
                >待审核</view
              >
              <view v-show="stateFlag >= 2.1" class="slot-desc-right"
                >审核时间： {{ twoTime }}</view
              >
            </view>
            <!-- 内容 -->
            <view v-show="stateFlag == 2.1" class="slot-desc-body">
              {{ twoRes }}
            </view>
          </view>
        </u-steps-item>
        <!-- 审核通过 -->
        <u-steps-item class="steps-item" title="审核通过">
          <view class="slot-desc" slot="desc">
            <!-- 头部 -->
            <view class="slot-desc-head">
              <view v-show="stateFlag > 2.1" class="slot-desc-left"></view>

              <view v-show="stateFlag > 2.1" class="slot-desc-right"
                >审核时间： {{ twoTime }}</view
              >
            </view>
            <!-- 内容 -->
            <!-- <view v-show="departmentaudit" class="slot-desc-body">
							未通过元婴未通过元婴未通过元婴未通过元婴未通过元婴
						</view> -->
          </view>
        </u-steps-item>

        <!-- <view class="eepartmentAuditbtn">
					<button class="Fail" @click="Failfn">不通过</button>
					<button class="pass" @click="passfn">通过</button>
				</view> -->
      </u-steps>

      <!-- 审核模态框 -->
      <u-modal
        :show="showModal"
        showCancelButton
        closeOnClickOverlay
        :confirmText="confirmText"
        :title="modalTitle"
        @confirm="confirmfn"
        @cancel="showModal = false"
        @close="showModal = false"
      >
        <view v-show="ispass" class="slot-content">
          <textarea
            class="modalTextarea"
            v-model="examineData.reason"
            placeholder="请输入不通过原因"
          ></textarea>
        </view>
      </u-modal>
    </view>
    <!-- tabs---病历表 -->
    <view v-show="tabsindex === 1" class="medicalRecord">
      <view v-if="!infoDetails.hospitalName" class="">
        <u-empty text="暂无记录"></u-empty>
      </view>
      <view v-else class="">
        <!-- 医院名称 -->
        <view class="hospitalName">
          <text class="hospitalName-title">医院名称：</text>
          <text class="hospitalName-content">{{
            infoDetails.hospitalName || "无数据"
          }}</text>
        </view>
        <!-- 科室 -->
        <view class="department">
          <text class="department-title">科室：</text>
          <text class="department-content">{{
            infoDetails.departmentName || "无数据"
          }}</text>
        </view>
        <!-- 主治医生 -->
        <view class="doctor">
          <text class="doctor-title">主治医生：</text>
          <text class="doctor-content">{{
            infoDetails.doctorName || "无数据"
          }}</text>
        </view>
        <!-- 病情摘要 -->
        <view class="conditionSummary">
          <text class="conditionSummary-title">病情摘要：</text>
          <text class="conditionSummary-content">
            {{ infoDetails.conditionDescription || "无数据" }}
          </text>
        </view>
        <!-- 诊断 -->
        <view class="diagnosis">
          <text class="diagnosis-title">诊断：</text>
          <text class="diagnosis-content">
            {{ infoDetails.diagnosis || "无数据" }}
          </text>
        </view>
        <!-- 收治指征和建床意见 -->
        <view class="indication-treatment">
          <text class="indication-treatment-title">收治指征和建床意见：</text>
          <text class="indication-treatment-content">
            {{ infoDetails.opinion || "无数据" }}
          </text>
        </view>
        <!-- 病历照片 -->
        <view class="medical-record-photos">
          <text class="medical-record-photos-title">病历照片：</text>
          <view
            v-if="infoDetails.fileUrl"
            class="medical-record-photos-content"
          >
            <view
              class="medical-record-photos-content-items"
              v-for="(item, index) in imgList"
              :key="index"
            >
              <image
                class="medical-record-photos-content-items-image"
                :src="item | filterUrl"
                @click="viewIMG(item)"
              ></image>
            </view>
          </view>
        </view>
      </view>
    </view>
    <!-- tabs---上门访视回执表 -->
    <view v-show="tabsindex === 2" class="homeVisit">
      <view v-if="!bedVisit.diagnosis" class="">
        <u-empty text="暂无记录"></u-empty>
      </view>

      <view v-else class="">
        <!-- 疾病诊断 -->
        <view class="diseasediagnosis">
          <text class="diseasediagnosis-title">疾病诊断：</text>
          <text class="diseasediagnosis-content">
            {{ bedVisit.diagnosis || "无数据" }}
          </text>
        </view>
        <!-- 诊断来源 -->
        <view class="diagnosisSource">
          <text class="diagnosisSource-title">诊断来源：</text>
          <text class="diagnosisSource-content">{{
            bedVisit.source || "无数据"
          }}</text>
        </view>
        <!-- 慢性疾病 -->
        <view class="chronicdisease">
          <text class="chronicdisease-title">慢性疾病：</text>
          <text class="chronicdisease-content">{{
            bedVisit.chronicDisease || "无数据"
          }}</text>
        </view>
        <!-- 药物及其他过敏史 -->
        <view class="drugallergy">
          <text class="drugallergy-title">药物及其他过敏史：</text>
          <text class="drugallergy-content">{{
            bedVisit.allergy || "无数据"
          }}</text>
        </view>
        <!-- 医疗保险 -->
        <view class="medicalinsurance">
          <text class="medicalinsurance-title">医疗保险：</text>
          <text class="medicalinsurance-content">{{
            bedVisit.medicalInsurance || "无数据"
          }}</text>
        </view>
        <!-- 生活能力 -->
        <view class="survivalskills">
          <text class="survivalskills-title">生活能力：</text>
          <text class="survivalskills-content">{{
            bedVisit.survivalSkills || "无数据"
          }}</text>
        </view>
        <!-- 特殊药物 -->
        <view class="specialdrugs">
          <text class="specialdrugs-title">特殊要求：</text>
          <text class="specialdrugs-content">{{
            bedVisit.specialRequire || "无数据"
          }}</text>
        </view>
        <!-- 常用药物 -->
        <view class="commonlyuseddrugs">
          <text class="commonlyuseddrugs-title">常用药物：</text>
          <text class="commonlyuseddrugs-content">{{
            bedVisit.useDrug || "无数据"
          }}</text>
        </view>
      </view>
    </view>
    <!-- tabs---生活能力评估表 -->
    <view v-show="tabsindex === 3" class="survivalSkills">
      <view v-if="evaluate" class="">
        <u-empty text="暂无记录"></u-empty>
      </view>
      <view v-else class="table">
        <view class="th">
          <text class="table-text thead">项目</text>
          <text class="table-text thead">评定标准</text>
          <text class="table-text thead">得分</text>
        </view>
        <view class="tr" v-for="(item, index) in tabList" :key="index">
          <text class="table-text">{{ item.name }}</text>
          <text class="table-text">{{ item.val }}</text>
          <text class="table-text">{{ item.val2 }}</text>
        </view>
        <view class="tr">
          <text class="table-footer-text">合计</text>
          <text class="table-footer-counts">{{ sum }}分</text>
        </view>
      </view>
    </view>

    <!-- 空状态 -->
    <u-empty
      v-if="steps === 0"
      class="emptynull"
      icon="/static/feixiang/icon/nullstate (2).png"
      text="请耐心等待医生上门评估"
    />
  </view>
</template>

<script>
import { getApplicationDetailsOne, getApplicationDetailsTwo, toExamine, sickbedBasicInfo, bedWithdrawalSure } from '@/api/feixiang/application.js'
import { imageUrl } from '@/config.js'
// import { sickbedBasicInfo, bedWithdrawalSure } from "@/api/feixiang/application.js"
export default {
  data () {
    return {
      sum: '', //合计得分
      stateFlag: '', //审核标志
      oneRes: '',
      oneTime: '',
      twoRes: '',
      twoTime: '',
      imgList: [],
      // 判断审核是否通过--改变步骤条状态
      doctorteamauditstatus: 0, //医生团队
      mechanismauditstatus: 3, //机构  //0通过 1未通过 2待审核
      departmentauditstatus: 2, //卫键局科室
      secretaryauditstatus: 2, //卫键局局长
      // 判断现在是哪个部门审核
      eepartmentaudit: 0, //部门审核步数
      // 判断审核是否通过--改变步骤条状态
      doctorteamaudit: false, //医生团队审核是否通过
      mechanismaudit: false, //机构审核是否通过   true表示未通过状态
      departmentaudit: false, //卫键局科室审核是否通过
      secretaryaudit: false, //卫键局局长审核是否通过
      steps: 1, //步骤条
      // tabs列表数组
      list: [{ name: '部门审核' }, { name: '病历表' }, { name: '上门访视回执表' }, { name: '生活能力评估表' }],
      tabsindex: 0, //tabs内容展示控制
      imagelist: [], //病历表的兵力照片
      tabList: [
        //生活能力评估表
        { name: '1、进食' },
        { name: '2、洗澡' },
        { name: '3、梳洗修饰' },
        { name: '4、穿衣' },
        { name: '5、控制大便' },
        { name: '6、控制小便' },
        { name: '7、如厕' },
        { name: '8、床椅转移' },
        { name: '9、行走' },
        { name: '10、上下楼梯' }
      ],
      src: [],
      reatmentRecordsList: [],
      treatmentrecords: 0, //治疗记录的步骤条 从1开始，0展示撤床成功状态
      revokebedstate: true, //是否撤床了
      patientconfirmation: true, //患者是否确认撤床了
      managerconfirms: false, //管理者确认撤床
      // 审核模态框处理
      ispass: false, //是否通过
      showModal: false, //审核模态框
      modalTitle: '',
      confirmText: '',
      formdata: {
        bedId: ''
      },
      infoDetails: {},
      // 机构信息
      agencyInfo: {},
      // 审核列表
      recordList: [],
      // 随访信息
      bedVisit: {},
      // 治疗记录
      teartRecord: [],
      examineData: {
        bedId: '',
        reason: '',
        state: ''
      },
      revokebeddata: {
        bedId: ''
      },
      sure: false,
      depsure: true,
      emptyState: true,
      evaluate: false
    }
  },
  filters: {
    imgfilter (val) {
      return imageUrl + val
    },
    timeFilter (time) {
      if (time == null || time == '') return ''
      let date = new Date(time)
      let year = date.getFullYear()
      let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
      let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
      let hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
      let minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
      let seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
      return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
    }
  },
  onLoad (options) {
    if (options.sure === 'true') {
      this.sure = true
      this.depsure = false
      this.list[0].name = '治疗记录'
    } else {
      this.sure = false
      this.depsure = true
      this.list[0].name = '部门审核'
    }
    this.formdata.bedId = options.bedId
    this.examineData.bedId = options.bedId
    this.revokebeddata.bedId = options.bedId
    this.init()
  },
  methods: {
    // 跳转机构详情
    goJigou () {
      uni.navigateTo({
        url: '/pages/feixiang/institution-details/institution-details?agencyId=' + this.agencyInfo.agencyId
      })
    },
    async init () {
      let a = '11'
      const res = await getApplicationDetailsOne(this.formdata)
      if (res.data.bed.state == '1.2') {
        this.steps = 0
        this.tabsindex = -1
        this.emptyState = false
      } else if (res.data.bed.state == '1.0') {
        this.steps = -1
      } else if (res.data.bed.state == '1.4') {
        this.steps = 1
        this.sure = false
        this.depsure = true
        this.list[0].name = '部门审核'
        this.mechanismaudit = true
      } else if (res.data.bed.state == '2.0') {
        this.steps = 1
      } else if (res.data.bed.state == '2.1') {
        this.steps = 1
        this.departmentaudit = true
      } else if (res.data.bed.state == '3.0') {
        this.steps = 3
        this.sure = true
        this.depsure = false
        this.list[0].name = '治疗记录'
        this.treatmentrecords = 999
      } else if (res.data.bed.state == '4.0') {
        this.steps = 3
      } else if (res.data.bed.state == '5.0' || res.data.bed.state == '6.0') {
        this.steps = 4
        this.sure = true
        this.depsure = false
        this.list[0].name = '治疗记录'
        this.treatmentrecords = 999
      }

      if (res.data.bed.state <= 1.4) {
        this.eepartmentaudit = 0
      }
      if (res.data.bed.state > 1.4 && res.data.bed.state <= 2.1) {
        this.eepartmentaudit = 1
      }
      if (res.data.bed.state > 2.1) {
        this.eepartmentaudit = 2
      }
      this.stateFlag = res.data.bed.state
      // console.log(res.data);
      // res.data.case.fileUrl.slice(',')
      // console.log(res.data.case.fileUrl.split(',')[0]);
      const res2 = await getApplicationDetailsTwo(this.formdata)
      this.infoDetails = { ...res.data.bed, ...res.data.case }
      // console.log(this.infoDetails.fileUrl, '538');
      if (this.infoDetails.fileUrl) {
        this.imgList = this.infoDetails.fileUrl.split(',')
        this.imgList.pop()
      } else {
        this.imgList = []
      }
      this.agencyInfo = res.data.feiAgency
      console.log('机构详情', this.agencyInfo)
      this.recordList = res2.data.recordList
      // 治疗记录数据
      res2.data.treatmentRecord.forEach((ele) => {
        // console.log(ele);
        if (ele.fileUrl) {
          const arr = ele.fileUrl.split(',')
          if (arr[arr.length - 1] === '') {
            arr.pop()
          }
          // console.log(arr);
          ele.fileUrl = arr
        } else {
          ele.fileUrl = []
        }
      })
      this.teartRecord = res2.data.treatmentRecord
      // this.oneRes = this.recordList[0].reason
      // this.oneTime = this.recordList[0].updateTime
      if (this.recordList[0]) {
        this.oneRes = this.recordList[0].reason
        this.oneTime = this.recordList[0].updateTime
      }
      if (this.recordList[1]) {
        this.twoRes = this.recordList[1].reason
        this.twoTime = this.recordList[1].updateTime
      }
      this.bedVisit = res.data.bedVisit
      if (res2.data.evaluate) {
        for (let i = 0; i < this.tabList.length; i++) {
          this.dataProcessing(i, res2)
        }
      } else {
        this.evaluate = true
      }

      let arr = []
      let sumAll = 0
      this.tabList.forEach((item) => {
        if (item.val2) {
          arr.push(Number(item.val2.split('分')[0]))
          sumAll += Number(item.val2.split('分')[0])
        }
      })
      // console.log(arr);
      this.sum = sumAll
    },
    click (event) {
      // console.log(event.index);
      this.tabsindex = event.index
    },
    // 跳转到病人信息
    informationfn () {
      uni.navigateTo({
        url: '/pages/feixiang/patient-information/patient-information?bedId=' + this.revokebeddata.bedId
      })
    },
    // 撤床

    // 审核不通过
    Failfn () {
      this.showModal = true
      this.modalTitle = '是否审核不通过？'
      this.confirmText = '驳回'
      this.ispass = true
    },
    // 审核通过
    async passfn () {
      this.showModal = true
      this.modalTitle = '是否审核通过？'
      this.confirmText = '通过'
      this.ispass = false
    },
    // 模态框确认事件
    async confirmfn () {
      this.showModal = false
      // console.log(this.content);
      // 如果点击了不通过,机构审核流程就不通过
      if (this.ispass) {
        //不通过
        this.examineData.state = '0.0'
        this.mechanismaudit = true
        this.mechanismauditstatus = 1
        const res = await toExamine(this.examineData)
        // console.log(res);
      } else {
        //通过
        this.examineData.state = '1.0'
        this.mechanismaudit = false
        this.mechanismauditstatus = 0
        const res = await toExamine(this.examineData)
        if (res.code === 200) {
          uni.reLaunch({
            url: '/pages/department/index/index'
          })
        }
      }
      // console.log(this.examineData);
    },
    // 确认撤床
    async revokebedfn () {
      const res = await bedWithdrawalSure(this.revokebeddata)
      if (res.code === 200) {
        uni.reLaunch({
          url: '/pages/feixiang/application-record/application-record'
        })
      }
    },

    // 查看图片
    viewIMG (val) {
      // console.log(val);
      val = imageUrl + val
      const arr = []
      arr.push(val)
      uni.previewImage({
        urls: arr
      })
    },
    imgclick (val) {
      console.log(val)
    },

    // 生活能力评估表数据处理
    dataProcessing (val, res2) {
      if (val === 0) {
        this.tabList[val].val = res2.data.evaluate.eat.split(' ')[0]
        this.tabList[val].val2 = res2.data.evaluate.eat.split(' ')[1]
      } else if (val === 1) {
        this.tabList[val].val = res2.data.evaluate.bath.split(' ')[0]
        this.tabList[val].val2 = res2.data.evaluate.bath.split(' ')[1]
      } else if (val === 2) {
        this.tabList[val].val = res2.data.evaluate.freshenup.split(' ')[0]
        this.tabList[val].val2 = res2.data.evaluate.freshenup.split(' ')[1]
      } else if (val === 3) {
        this.tabList[val].val = res2.data.evaluate.dressing.split(' ')[0]
        this.tabList[val].val2 = res2.data.evaluate.dressing.split(' ')[1]
      } else if (val === 4) {
        this.tabList[val].val = res2.data.evaluate.controlStool.split(' ')[0]
        this.tabList[val].val2 = res2.data.evaluate.controlStool.split(' ')[1]
      } else if (val === 5) {
        this.tabList[val].val = res2.data.evaluate.controlUrination.split(' ')[0]
        this.tabList[val].val2 = res2.data.evaluate.controlUrination.split(' ')[1]
      } else if (val === 6) {
        this.tabList[val].val = res2.data.evaluate.toilet.split(' ')[0]
        this.tabList[val].val2 = res2.data.evaluate.toilet.split(' ')[1]
      } else if (val === 7) {
        this.tabList[val].val = res2.data.evaluate.bedChairMove.split(' ')[0]
        this.tabList[val].val2 = res2.data.evaluate.bedChairMove.split(' ')[1]
      } else if (val === 8) {
        this.tabList[val].val = res2.data.evaluate.walk.split(' ')[0]
        this.tabList[val].val2 = res2.data.evaluate.walk.split(' ')[1]
      } else if (val === 9) {
        this.tabList[val].val = res2.data.evaluate.goUpstairs.split(' ')[0]
        this.tabList[val].val2 = res2.data.evaluate.goUpstairs.split(' ')[1]
      }
    }
  }
};
</script>

<style scoped>
* {
  box-sizing: border-box;
}
.content-body-right-address1 {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  width: 447rpx;
}
.content-body-right-address {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  width: 480rpx;
}
/* 空状态图片---h5适配 */
>>> uni-image > div {
  /* width: 80rpx;
		height: 80rpx; */
  margin-left: 50%;
  /* margin-top: 10%; */
  transform: translate(-50%);
}
/* 空状态图片---微信小程序适配 */
>>> image {
  width: 80rpx !important;
  height: 80rpx !important;
  margin-top: 20%;
}

.top {
  background-color: #fff;
  padding: 0 20rpx;
}
.top-title {
  display: flex;
  align-items: center;
  padding: 20rpx 0;
  font-size: 32rpx;
  border-bottom: 2rpx solid #f7f7f7;
}
.top-title-name {
  font-weight: 600;
}
.top-title-more {
  color: #00bcb2;
  flex: 1;
  text-align: right;
}
.top-content {
  height: 200rpx;
  background-color: #fff;
  font-size: 32rpx;
}
.numbering {
  display: flex;
  justify-content: space-between;
  margin: 20rpx 0;
}
.numbering-title {
  color: #777;
}
.contact {
  display: flex;
  justify-content: space-between;
  margin: 20rpx 0;
}
.contact-title {
  color: #777;
}
.dateapplication {
  display: flex;
  justify-content: space-between;
  margin: 20rpx 0;
}
.dateapplication-title {
  color: #777;
}
/* 机构信息 */
.content {
  border-top: 10px solid #f7f7f7;
  padding: 20px 20px 0 20px;
}
.content-title {
  font-size: 32rpx;
  font-weight: 600;
  padding-bottom: 20rpx;
  border-bottom: 4rpx solid #f7f7f7;
}
.content-body {
  display: flex;
  padding-top: 32rpx;
}
/* 图片样式覆盖 */
.content-body-left {
  width: 140rpx;
  height: 140rpx;
  border-radius: 16rpx;
  overflow: hidden;
}
.content-body-left-image {
  width: 100% !important;
  height: 100% !important;
  margin: 0;
}
.content-body-right {
  background-color: #fff;
  display: flex;
  flex: 1;
  margin-left: 24rpx;
  font-size: 32rpx;
  flex-direction: column;
  justify-content: space-between;
}
.team {
  padding-top: 32rpx;
}
.team-title {
  font-size: 28rpx;
  margin-bottom: 12rpx;
}
.team-items {
  display: flex;
  justify-content: space-between;
}
.team-items-name {
  font-size: 32rpx;
  font-weight: 600;
}
.team-items-icon {
  width: 32rpx;
  height: 32rpx;
  margin-top: 6rpx;
}
.items-icon-arrow {
  width: 100% !important;
  height: 100% !important;
  margin: 0;
}
/* 分割线 */
.dividingLine {
  height: 20rpx;
  background-color: #f7f7f7;
  margin-top: 40rpx;
  margin-bottom: 28rpx;
}

/* 审核流程tabs */
.uni-scroll-view {
  border-bottom: 2rpx solid #f7f7f7;
}
/* tabs---部门审核 */
.eepartmentAudit {
  padding: 36rpx 32rpx 52rpx 32rpx;
}
.slot-desc {
  border-bottom: 4rpx solid #f7f7f7;
  padding-bottom: 24rpx;
}
.slot-desc-error {
  color: #df060d;
}
.slot-desc-right {
  color: #999;
}
.slot-desc-head {
  display: flex;
  justify-content: space-between;
}

.slot-desc-body {
  background-color: #f7f7f7;
  padding: 28rpx 20rpx;
  border-radius: 8rpx;
  margin-top: 16rpx;
}

.u-steps-item__line--column {
  height: 100% !important;
  width: 0 !important;
  border-right: 2px dotted rgb(150, 151, 153);
  background-color: #fff !important;
  left: 18rpx !important;
}
/* 审核底部按钮 */
.eepartmentAuditbtn {
  /* background-color: #8df; */
  display: flex;
  justify-content: space-between;
}
.modalTextarea {
  width: 526rpx;
  height: 212rpx;
  background-color: #f7f7f7;
  padding: 28rpx;
  border-radius: 16rpx;
}
.Fail {
  width: 324rpx;
  height: 88rpx;
  border-radius: 48rpx;
  border: 2rpx solid #00bcb2;
  color: #00bcb2;
  background-color: #fff;
}
.pass {
  width: 324rpx;
  height: 88rpx;
  border-radius: 48rpx;
  background-color: #00bcb2;
  color: #fff;
}
/* tabs---病历表 */
.medicalRecord {
  padding: 32rpx 32rpx 56rpx 32rpx;
  font-size: 32rpx;
}
.hospitalName {
  margin-bottom: 20rpx;
}
.hospitalName-title {
  color: #777;
}
.department {
  margin-bottom: 20rpx;
}
.department-title {
  color: #777;
}
.doctor {
  margin-bottom: 20rpx;
}
.doctor-title {
  color: #777;
}
.conditionSummary {
  margin-bottom: 20rpx;
}
.conditionSummary-title {
  color: #777;
}
.diagnosis {
  margin-bottom: 20rpx;
}
.diagnosis-title {
  color: #777;
}
.indication-treatment {
  margin-bottom: 20rpx;
}
.indication-treatment-title {
  color: #777;
}
.medical-record-photos-title {
  color: #777;
}
.medical-record-photos-content {
  margin-top: 20rpx;
  display: flex;
  flex-wrap: wrap;
}
.medical-record-photos-content-items {
  width: 212rpx;
  height: 212rpx;
  border-radius: 16rpx;
  overflow: hidden;
  display: flex;
}
.medical-record-photos-content-items-image {
  width: 100% !important;
  height: 100% !important;
  margin: 0;
}
/* tabs---上门访视回执表 */
.homeVisit {
  padding: 32rpx 32rpx 56rpx 32rpx;
  font-size: 32rpx;
}
.diseasediagnosis {
  margin-bottom: 20rpx;
}
.diseasediagnosis-title {
  color: #777;
}
.diagnosisSource {
  margin-bottom: 20rpx;
}
.diagnosisSource-title {
  color: #777;
}
.chronicdisease {
  margin-bottom: 20rpx;
}
.chronicdisease-title {
  color: #777;
}
.drugallergy {
  margin-bottom: 20rpx;
}
.drugallergy-title {
  color: #777;
}
.medicalinsurance {
  margin-bottom: 20rpx;
}
.medicalinsurance-title {
  color: #777;
}
.survivalskills {
  margin-bottom: 20rpx;
}
.survivalskills-title {
  color: #777;
}
.specialdrugs {
  margin-bottom: 20rpx;
}
.specialdrugs-title {
  color: #777;
}
.commonlyuseddrugs {
  margin-bottom: 20rpx;
}
.commonlyuseddrugs-title {
  color: #777;
}
/* tabs---生活能力评估表 */
.survivalSkills {
  padding: 24rpx 32rpx 42rpx 32rpx;
}
.th {
  display: flex;
  justify-content: space-between;
}
.table-text {
  flex: 1;
  text-align: center;
  width: 226rpx;
  height: 76rpx;
  line-height: 76rpx;
  background-color: #f7f7f7;
  border-bottom: 4rpx solid #fff;
  border-right: 4rpx solid #fff;
}
.thead {
  background-color: #c7e3ff;
}
.table-footer-text {
  width: 226rpx;
  height: 76rpx;
  line-height: 76rpx;
  text-align: center;
  background-color: #f7f7f7;
  border-bottom: 4rpx solid #fff;
  border-right: 4rpx solid #fff;
}
.table-footer-counts {
  flex: 1;
  width: 226rpx;
  height: 76rpx;
  line-height: 76rpx;
  background-color: #f7f7f7;
  border-bottom: 4rpx solid #fff;
  border-right: 4rpx solid #fff;
  text-align: right;
  padding-right: 90rpx;
}
.tr {
  display: flex;
  justify-content: space-between;
}
/* tabs---治疗记录 */
.reatmentRecords {
  padding: 36rpx 32rpx 120rpx 32rpx;
}

.steps-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8rpx;
}
.steps-title-left {
  font-size: 32rpx;
}
.steps-title-right {
  color: #999;
}
.steps-content {
  width: 100%;
}
.steps-content-head {
  margin-bottom: 16rpx;
}
.steps-content-head-text {
  color: #999;
  margin-left: 16rpx;
}
.steps-content-body {
  background-color: #f7f7f7;
  padding: 32rpx 20rpx 32rpx 20rpx;
  border-radius: 8rpx;
}
.treatmentOrder {
  margin: 20rpx 0;
}
.treatmentPictures {
  display: flex;
  flex-wrap: wrap;
}
.remark {
  margin-bottom: 20rpx;
}
.image-box {
  width: 184rpx;
  height: 184rpx;
  border-radius: 16rpx;
  overflow: hidden;
}
.treatmentPictures-image {
  width: 100% !important;
  height: 100% !important;
  margin: 0;
}
.btn-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 10rpx 32rpx;
}
/* 撤床按钮 */
.revokebedbtn {
  width: 100%;
  height: 96rpx;
  background-color: #00bcb2;
  color: #fff;
  border-radius: 60rpx;
  margin-top: 40rpx;
}
/* 撤床记录样式 */
.revokebed-slot-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8rpx;
}
.revokebed-slot-head-left {
  font-size: 32rpx;
}
.revokebed-slot-head-right {
  color: #999;
}
.revokebed-slot-body {
  /* background-color: pink; */
}
.revokebed-slot-body-title {
  margin-bottom: 16rpx;
}
.revokebed-slot-body-box {
  background-color: #f7f7f7;
  padding: 32rpx 20rpx;
  display: flex;
  justify-content: space-between;
  border-radius: 8rpx;
}
.revokebed-slot-manager {
  background-color: #f7f7f7;
  padding: 32rpx 20rpx;
  border-radius: 8rpx;
}
.revokebed-slot-body-box-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  border-radius: 8rpx;
}
.revokebed-slot-body-box-right {
  color: #999;
}
.content-body-right-image {
  width: 40rpx !important;
  height: 40rpx !important;
  margin: 0;
}
</style>
